Should I use multiple threads in this situation? [Ruby]

Posted by mr popo on Stack Overflow See other posts from Stack Overflow or by mr popo
Published on 2010-04-22T00:00:07Z Indexed on 2010/04/22 0:03 UTC
Read the original article Hit count: 151

Filed under:
|
|

I'm opening multiple files and processing them, one line at a time. The files contain tokens separating the data, such that sometimes the processing of one file may have to wait for others to catch up to that same token.

I was doing this initially with only one thread and an array indicating with true/false if the file should be read in the current iteration or if it should wait for some of the others to catch up.

Would using threads make this simpler? More efficient? Does Ruby have a mechanism for this?

© Stack Overflow or respective owner

Related posts about multithreading

Related posts about design